﻿#pragma once
#include "wcs_data.h"
#include "json_trans.h"


structJ(RobItemApplyJ,
	mapping(QString, robNo);
	mapping(QString, skuNo);
	mapping(QString, taskId);
	mapping(int, msgId);
	mapping(int, type);
	mapping(int, num);
	mapping(int, pos);
	prop(&robNo, &skuNo, &type, &num, &pos, &taskId, &msgId);
	)

inline RobItemApplyJ RobItemApplyJTransFrom(wcs::RobItemApply& data)
{
	RobItemApplyJ out = {};
	out.robNo = data.robNo;
	out.skuNo = data.skuNo;
	out.type = data.type;
	out.num = data.num;
	out.pos = data.pos;
	out.taskId = data.taskId;
	out.msgId = data.msgId;
	return out;
}
inline wcs::RobItemApply RobItemApplyJTransTo(RobItemApplyJ& data)
{
	wcs::RobItemApply out = {};
	out.robNo = data.robNo();
	out.skuNo = data.skuNo();
	out.type = data.type();
	out.pos = data.pos();
	out.taskId = data.taskId();
	out.msgId = data.msgId();
	return out;
}


structJ(ItemApplyAnsJ,
	mapping(int, result);
	mapping(int, type);
	mapping(int, num);
	prop(&result, &type, &num);
)

inline ItemApplyAnsJ ItemApplyAnsJTransFrom(wcs::ItemApplyAns& data)
{
	ItemApplyAnsJ out = {};
	out.result = data.result;
	out.type = data.type;
	out.num = data.num;
	return out;
}
inline wcs::ItemApplyAns ItemApplyAnsJTransTo(ItemApplyAnsJ& data)
{
	wcs::ItemApplyAns out = {};
	out.result = data.result();
	out.type = data.type();
	out.num = data.num();
	return out;
}

structJ(RobTaskFinishJ,
	mapping(QString, robNo);
	mapping(QString, taskId);
	mapping(int, taskNum);
	mapping(QString, stackPlace);
	mapping(int, taskFinish);
	mapping(int, stackFinish);
	mapping(int, residueNum);
	prop(&robNo, &taskId, &taskNum, &stackPlace, &taskFinish, &stackFinish, &residueNum);
	)

inline RobTaskFinishJ RobTaskFinishJTransFrom(wcs::RobTaskFinish& data)
{
	RobTaskFinishJ out = {};
	out.robNo = data.robNo;
	out.taskId = data.taskId;
	out.taskNum = data.taskNum;
	out.stackPlace = data.stackPlace;
	out.taskFinish = data.taskFinish;
	out.taskNum = data.taskNum;
	out.stackFinish = data.stackFinish;
	out.residueNum = data.residueNum;
	return out;
}
inline wcs::RobTaskFinish RobTaskFinishJTransTo(RobTaskFinishJ& data)
{
	wcs::RobTaskFinish out = {};
	out.robNo = data.robNo();
	out.taskId = data.taskId();
	out.taskNum = data.taskNum();
	out.stackPlace = data.stackPlace();
	out.taskFinish = data.taskFinish();
	out.taskNum = data.taskNum();
	out.stackFinish = data.stackFinish();
	out.residueNum = data.residueNum();
	return out;
}

//structJ(TaskFinishAnsJ,
//	mapping(QString, taskId);
//	prop(&taskId);
//}

structJ(RobSkuMoveJ,
	mapping(QString, robNo);
	mapping(QString, taskId);
	mapping(QString, boxLine);
	mapping(int, boxNum);
	mapping(QList<QString>, boxIdList);
	prop(&robNo, &taskId, &boxLine, &boxNum,&boxIdList)
	)


inline RobSkuMoveJ RobSkuMoveJTransFrom(wcs::RobSkuMove& data)
{
	RobSkuMoveJ out = {};
	out.robNo = data.robNo;
	out.taskId = data.taskId;
	out.boxLine = data.boxLine;
	out.boxNum = data.boxNum;
	for (auto& iter : data.boxId) {
		out.boxIdList().append(iter);
	}
	return out;
}
inline wcs::RobSkuMove RobSkuMoveJTransTo(RobSkuMoveJ& data)
{
	wcs::RobSkuMove out = {};
	out.robNo = data.robNo();
	out.taskId = data.taskId();
	out.boxLine = data.boxLine();
	out.boxNum = data.boxNum();
	for (auto& iter : data.boxIdList()) {
		out.boxId.append(iter);
	}
	return out;
}

structJ(RobArriveInfoJ,
	mapping(QString, robNo);
	mapping(QString, taskId);
	mapping(QString, place);
	mapping(int, type);
	mapping(int, num);
	mapping(int, msgId);
	prop(&robNo, &taskId, &msgId, &type, &num, &place)
)

inline RobArriveInfoJ RobArriveInfoJTransFrom(wcs::RobArriveInfo& data)
{
	RobArriveInfoJ out = {};
	out.robNo = data.robNo;
	out.taskId = data.taskId;
	out.type = data.type;
	out.num = data.num;
	out.msgId = data.msgId;
	out.place = data.place;
	return out;
}
inline wcs::RobArriveInfo RobArriveInfoJTransTo(RobArriveInfoJ& data)
{
	wcs::RobArriveInfo out = {};
	out.robNo = data.robNo();
	out.taskId = data.taskId();
	out.type = data.type();
	out.num = data.num();
	out.msgId = data.msgId();

	return out;
}
